package com.itheima.d2_collection_nesting;

import java.util.ArrayList;

public class Test2 {
    public static void main(String[] args) {
        ArrayList<String> group1 = new ArrayList<>();
        group1.add("张三");
        group1.add("张三丰");
        group1.add("张无忌");

        ArrayList<String> group2 = new ArrayList<>();
        group2.add("李四");
        group2.add("李四丰");
        group2.add("李有忌");

        ArrayList<ArrayList<String>> classes = new ArrayList<>();
        classes.add(group1);
        classes.add(group2);

        for (ArrayList<String> group : classes) {
            //组
            System.out.println(group);
            for (String name : group) {
                System.out.println("\t" + name);
            }
        }
    }
}
